<!DOCTYPE html>
<html lang="zh-cn" xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="keywords" th:content="${config.keywords}">
    <meta name="description" th:content="${config.decText}">
    <link rel="shortcut icon" id="favicon" href="/static/favicon.ico"/>
    <title th:text="${config.siteName}"></title>
    <link href="/static/css/bootstrap.css" rel="stylesheet">
    <link href="/static/css/font-awesome.min.css" rel="stylesheet">
    <link href="/static/css/index2.css" rel="stylesheet">
    <link href="/static/layer/mobile/need/layer.css" rel="stylesheet">
    <script type="text/javascript" charset="utf-8" src="/static/js/jquery-1.11.3.min.js"></script>
    <script src="/static/js/bootstrap.js"></script>
    <script type="text/javascript" src="/static/layer/layer.js"></script>
</head>
<body id="home" style="">
<th:block th:include="~{include/header.html::header}"></th:block>
<section id="services" style="padding: 00px;">
    <div class="login_container">
        <div class="login_header">
            <h1 style="text-align: center;">
                用户注册
            </h1>
        </div>
        <div class="login_box" style="height: auto;">
            <p style="text-align: center;">
                <span style="color: green;text-align: center;">商户申请价格为：
                    <span style="color: red;" th:text="${config.regPrice}"></span>元
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <th:block th:if="${!#strings.isEmpty(e2)}">
                         推荐用户:
                        <span style="color: #00F7DE;" th:text="${e_user.user}"></span>
                        <input type="hidden" name="extenKey" th:value="${e2}">
                    </th:block>
                </span>
            </p>
            <div class="login_box_main" id="main_context">
                <form method="post" class="layui-form" id="registerform" method="post" onsubmit="return false;">
                    <div class="input_box input1">
                        <select name="pre_pay_type" class="input1">
                            <option value="2">结算方式:支付宝</option>
                            <option value="-1">其他结算方式注册后配置</option>
                        </select>
                    </div>
                    <div class="input_box">
                        <input class="input1" id="ps" type="text" name="pre_account"
                               autocomplete="new-password" value="" datatype="*8-16"
                               placeholder="输入结算账号"/>
                    </div>
                    <div class="input_box">
                        <input class="input1" name="pre_zs_name" type="text"
                               maxlength="32" autocomplete="off" value=""
                               placeholder="真实姓名"/>
                    </div>
                    <th:block th:if="${reg_config.notifyType == 0}">
                        <div class="input_box">
                            <input class="input1" type="text"
                                   autocomplete="off" value="" datatype="m" id="email" name="email"
                                   placeholder="邮箱(用于接收商户信息)"/>
                        </div>
                    </th:block>
                    <th:block th:if="${reg_config.notifyType != 0}">
                        <div class="input_box">
                            <input class="input1" type="text"
                                   autocomplete="off" value="" datatype="m" id="email" name="email"
                                   placeholder="手机号(用于接收商户信息)"/>
                        </div>
                    </th:block>
                    <div class="input_box">
                        <input class="input1" style="float: left;width: 70%;" type="text" autocomplete="off" value=""
                               name="vcode" placeholder="验证码">
                        <button type="button" class="input1 "
                                style="float: left;width: 30%;background: greenyellow;color: darkred;"
                                onclick="send_vcode(this)"><span>点击获取</span>
                        </button>
                    </div>
                    <div class="input_box">
                        <label style="font-size: 14px;display: inline-flex;">
                            <input id="yuedu" type="checkbox" name="check" value="223">我已同意
                            <a href="javascript:open_item();" style="color:#37a12b">《用户协议》</a>
                        </label>
                    </div>
                    <p class="login_btn">
                        <button value="注册" lay-submit lay-filter="login" style="width:100%;" type="submit"
                                onclick="submit_reg(this);" ng-disabled='form.$invalid'>
                            注册
                        </button>
                    </p>
                </form>
                <p class="forget_box">
                    <a href="/admin/login" ui-sref="access.signup" class="a1 ">
                        用户登录
                    </a>
                    <a class="a3" ui-sref="access.forgotpwd" href="/re_email">
                        忘记密码
                    </a>
                </p>
            </div>
        </div>
    </div>
</section>
<section id="contact-us" style="background: white;color: blue;padding: 10px;">
    <div class="container">
        <div class="section-header">
            <h2 class="section-title text-center wow fadeInDown">联系我们</h2>
            <p class="text-center wow fadeInDown"
               th:utext="'商户交流QQ群:'+${config.kfqqq}+' &nbsp; 网站客服QQ:'+${config.kfqq}"></p>
        </div>
    </div>
</section>
<footer id="footer">
    <div class="container">
        <div class="row">
            <div class="col-sm-6">
                <th:block th:text="'Copyright ©2020 '+${config.copyright}+' All rights reserved.'"></th:block>
                <a href="http://www.miibeian.gov.cn/" target="_blank" th:text="${config.icpInfo}"></a>
            </div>
            <div class="col-sm-6"></div>
        </div>
    </div>
</footer>
<div id="kpoint_edit" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title">用户许可条款</h4>
            </div>
            <div class="modal-body" id="kpoint_list" style="background: url('/static/images/bg1.jpg');">

            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" onclick="close_item()">关闭</button>
            </div>
        </div>
    </div>
</div>
</body>
<script>

    var validCode = true;

    /**
     * 发送邮件验证码
     */
    function send_vcode(obj) {
        var time = 60;
        var code = $(obj);
        // code.disable();
        code.html("<span>请稍等</span>");
        var to_user = $("#email").val();
        $.post("/send_vcode",
            {"email": to_user},
            function (data) {
                layer.msg(data.msg);
                if (data.code == 0) {
                    if (validCode) {
                        validCode = false;
                        var t = setInterval(function () {
                            time--;
                            code.html("<span>" + time + "秒</span>");
                            if (time == 0) {
                                clearInterval(t);
                                //   code.enable();
                                code.html("<span>重新获取</span>");
                                validCode = true;
                            }
                        }, 1000)
                    }
                } else {
                    //   code.enable();
                    code.html("<span>重新获取</span>");
                }
            }, "json");
    }

    /**
     * 提交注册
     */
    function submit_reg(obj) {
        console.log($("#registerform").serialize());
        var code = $(obj);
        code.html("<span>请稍等</span>");
        $.post("/reg_save",
            $("#registerform").serialize(),
            function (data) {
                layer.msg(data.msg);
                if (data.code == 0) {
                    setTimeout(function () {
                        location.href = "/pay_check?oid=" + data.oid + "&times=" + new Date().getTime();
                    }, 800);
                } else {
                    code.html("<span>注册</span>");
                }
            }, "json");
    }

    function open_item() {
        console.log("open_item");
        $('#kpoint_edit').modal('show');
        $("#kpoint_list").load("/readme", function (response, status, xhr) {
            if (status != "success") {
                $("#kpoint_list").load("/error");
            }
        });
    }

    function close_item() {
        console.log("close_item");
        $('#kpoint_edit').modal('hide');
    }

</script>
</html>